Data shift, including cyclic shift, is indispensable to versatile signal processing techniques. To shift data, sequential shift registers are generally used. Since such shift registers take a long time to shift data, a barrel shifter has been proposed which uses a logic circuit for data shift.
FIG. 1 shows a barrel shifter capable of shifting data right. FIG. 2 illustrates one of selectors 11 serving as basic units, in more detail. FIG. 3 is a circuit diagram of the selector of FIG. 2, where the left data XL or right data XR is selected, depending on a signal a (a, a) and then supplied as an output S.
In FIG. 1, a right shift is performed on input data X (X7=a, X6=b, X5=c, ..., X1=g, X0=h) according to a given shift value ranging from 0 to 7 (a binary control signal a2, a1, a0). That is, a desired shift is carried out by setting a control signal (a2, a1, a0) to a different value for each row or stage, and then selecting either left or right data (XL, XR) as the input data to each stage according to the control signal. For example, to shift data right 5 bit positions, the control signal (a2, a1, a0) is set to (1, 0, 1). Then, the left input (XL) is selected by each selector 11 in the first row (the first stage) from the top of the figure to perform a right shift of 1 bit position. Similarly, in the second row (the second stage), the right input (XR) is selected to perform a right shift of 0 bit position, that is, to allow the data to pass through downward without any change. In the third row (the third stage), with a2=1, the left input (XL) is selected to make a right shift of 4 bit positions.
Thus, by causing data to pass through the 3 stages of shift circuits, a right shift of 5 bit positions in total is carried out. This process is illustrated in FIG. 4. As seen from the figure, the input data X=a through h is shifted right 1 bit position at the first stage, and 4 bit positions at the third stage, resulting in a right shift of a total of 5 bit positions. In FIG. 1, numeral 12 indicates a 0-setting section that supplies a 0 to the unoccupied selectors after the shift.
FIG. 5 shows a conventional barrel shifter capable of performing a right and left shift, FIG. 6 is a detailed view of one of the selectors 11 serving as basic units, and FIG. 7 illustrates the circuit of FIG. 6 in more detail. In FIG. 5, among the rows where selectors are arranged in the horizontal direction, the upper three rows (three stages) from the top of the figure have a right shift circuit (indicated by numeral 21) and a left shift circuit (indicated numeral 22), which are located in parallel. A right or left shift is performed by shifting data right or left a desired number of bit positions according to the control signal a0 through a2, and then selecting either the right shift value or the left shift value, the output S7 through S0, according to the select signal SL. FIG. 8 illustrates how a right shift of 5 bit positions is performed.
FIG. 9 shows another conventional bidirectional barrel shifter. FIG. 10 is a detailed view of one of the selectors 11 serving as basic units, and FIG. 11 illustrates the circuit of FIG. 10 in more detail. The selectors 31 in the first through third stages from the top of the figure are used to shift data right 0 to 7 bit positions, and the following three stages 32 are used to perform a left shift of 0 to 7 bit positions. The select signal RS causes the unselected one of the stages 31 and 32 to allow data to pass through as it is.
As noted above, to make a right or left shift in conventional shifters, separate right barrel shifters (such as indicated by 21 and 31) and left barrel shifters (such as indicated by 22 and 32) perform desired shifts. After the shift, depending on whether it is a right or left shift, the output of the right or left barrel shifter is selected. For this reason, conventional devices require more than twice as many selectors as those needed for the right or left barrel shifter. This increases the circuit size, and IC chip size.
Accordingly, the object of the present invention is to minimize the circuit size by reducing the number of selectors used in the right and left barrel shifter through common use of the selectors for a right and a left shift, on the condition that a right shift and left shift are not performed at the same time.